package org.krivtsun.jpref;

class Card implements Comparable<Card> {

    private Rank rank;
    private Suit suit;

    Card(Rank rank, Suit suit) {
        this.rank = rank;
        this.suit = suit;
    }

    Rank getRank() { return rank; }
    Suit getSuit() { return suit; }

    public String toString() {
        return rank.toString() + suit.toString();
    }

    public int compareTo(Card c) {
        int result = suit.compareTo(c.suit);
        if (result == 0) {
            result = rank.compareTo(c.rank);
        }
        return result;
    }
}
